home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programmer's Power Pack / Delphi Volume 1.iso / e_to_l / fbuilder / delphi / demos / funcdlg.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-09-15  |  1.9 KB  |  90 lines

  1. { FormulaBuilder                }
  2. { YGB Software, Inc.            }
  3. { Copyright 1995 Clayton Collie }
  4. { All rights reserved           }
  5.  
  6. {* Dialog which lists all functions registered with the FormulaBuilder *}
  7. {* Engine                                                              *}
  8.  
  9. unit Funcdlg;
  10. interface
  11. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, Buttons,
  12.   StdCtrls, ExtCtrls;
  13.  
  14. type
  15.   TFunctionDlg = class(TForm)
  16.     OKBtn: TBitBtn;
  17.     CancelBtn: TBitBtn;
  18.     HelpBtn: TBitBtn;
  19.     Bevel1: TBevel;
  20.     FunctionList: TListBox;
  21.     GroupBox1: TGroupBox;
  22.     Memo1: TMemo;
  23.     FunctionCountLabel: TLabel;
  24.     procedure FormCreate(Sender: TObject);
  25.   private
  26.     { Private declarations }
  27.   public
  28.     { Public declarations }
  29.   end;
  30.  
  31. var
  32.   FunctionDlg: TFunctionDlg;
  33.  
  34.   Procedure DisplayFunctionList;
  35.  
  36. implementation
  37. uses  fbCalc,sysutils,fbmisc;
  38.  
  39. {$R *.DFM}
  40. {$F+}
  41.  
  42. var
  43.    Tmpdlg : TFunctionDlg;
  44.  
  45.  
  46. Procedure DisplayFunctionList;
  47. var dlg : TFunctionDlg;
  48. begin
  49.   InitFbuilder;
  50.   Dlg := TFunctionDlg.Create(NIL);
  51.   try
  52.     Dlg.ShowModal;
  53.   Finally
  54.     Dlg.Free;
  55.     FreeFbuilder;
  56.   end;
  57. end;
  58.  
  59. Function GetFuncNames(vname   : pchar;
  60.                       vtype   : byte;
  61.                       parms   : pchar;
  62.                       minPrms : byte;
  63.                       lParam  : longint):integer; export;
  64. var proto,tmp : string[60];
  65.     i   : integer;
  66.  
  67. begin
  68.   tmp   := strpas(parms);
  69.   Proto := ShortPrototype(strpas(vname),tmp,length(tmp),minprms);
  70.   tmp   := DataTypeName(vType);
  71.   Proto := Proto + ':'+tmp;
  72.   TmpDlg.FunctionList.Items.Add( proto );
  73. end;
  74.  
  75.  
  76.  
  77.  
  78. procedure TFunctionDlg.FormCreate(Sender: TObject);
  79. begin
  80.   tmpDlg := Self;
  81.   InitFbuilder; { Just to be safe }
  82.   if not FBLoaded then exit;
  83.   FBEnumFunctions( GetFuncNames  , LONGINT(0) );
  84.   With FunctionCountLabel do
  85.        Caption := Caption + IntToStr(FBGetFunctionCount);
  86.   FreeFBuilder;
  87. end;
  88.  
  89. end.
  90.